package com.example.Interceptor.test;/*
   
/**
* @program: demo
*
* @description: 拦截器管理类
*
* @author: kk
*
* @create: 2020-03-20 15:45
**/

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration//作为一个配置类
public class MangerInterceptor implements WebMvcConfigurer {

  /*  @Override
    protected void  addInterceptors(InterceptorRegistry registry) {
        //DemoInterceptor拦截所有请求
        registry.addInterceptor(new DemoInterceptor()).addPathPatterns("/**");
        //
        super.addInterceptors(registry);
    }*/
    @Override
    public  void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new DemoInterceptor()).addPathPatterns("/**");//拦截所有的请求
    }
}
